<?php
//===== 分割gif =====
$picture = new Imagick('18.gif');
$i=0;
foreach($picture as $frame){
    $f='frame-'.$i.'.gif';
    file_put_contents($f,$frame);
    $i++;
}

//====== 把一副图片覆盖到另外一副上面=====
$im = new Imagick('frame-1.gif');
$canvas=new Imagick();
$width = $im->getImageWidth() + 40;
$height = $im->getImageHeight() + 40;
$canvas->newImage($width, $height, new ImagickPixel("black"));
$canvas->setImageFormat("png");
$canvas->compositeImage($im, imagick::COMPOSITE_OVER, 20, 10);
